#include <vector>
#include <iostream>

using namespace std; 

class Solution {
public:
const int inf=0x3f3f3f3f;
    int maxArea(vector<int>& height) {
        int n=height.size();
        int ret=-inf; 
        int left=0;
        int right=n-1;
        while(left<right)
        {
            int area=min(height[left],height[right])*(right-left);
            ret=max(ret,area);
            if(height[left]<height[right])left++;
            else right--;
        }
        return ret; 
    }
};